package org.wuqiupeng.main;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;

import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.wuqiupeng.util.HttpXmlClient;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; 


@Controller
public class IndexController {
    @RequestMapping("/index")
    public String index(Model model,HttpServletRequest request){
 
        return "index";
    }
    
    @RequestMapping("/getlocation")
    public String getLocation(Model model,HttpServletRequest request){
        
    	HttpXmlClient.getAuthorization("getlocation");
    	System.out.println(HttpXmlClient.getSignature());
        model.addAttribute("signature", HttpXmlClient.getSignature());
        model.addAttribute("timestamp", HttpXmlClient.getTimestamp()); 
        model.addAttribute("noncestr", HttpXmlClient.getNoncestr());  
        model.addAttribute("appId", HttpXmlClient.getCorpid());
   
        return "getlocation";
    }
    
    
    @RequestMapping("/openlocation")
    public String openLocation(Model model,HttpServletRequest request){
        
    	HttpXmlClient.getAuthorization("openlocation");
    	System.out.println(HttpXmlClient.getSignature());
        model.addAttribute("signature", HttpXmlClient.getSignature());
        model.addAttribute("timestamp", HttpXmlClient.getTimestamp()); 
        model.addAttribute("noncestr", HttpXmlClient.getNoncestr());  
        model.addAttribute("appId", HttpXmlClient.getCorpid());
   
        return "openlocation";
    }
    
}
